package ch.zbw.pra.sysventory.ui.gui.panels.overviewandsearchpanel.subpanels.detailPanel;

import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;

import javax.swing.JPanel;

import ch.zbw.pra.sysventory.domain.model.Computer;
import ch.zbw.pra.sysventory.ui.gui.utilities.GuiLayout;

public class DetailPanel extends JPanel {

	private static final long serialVersionUID = 1623332541045181571L;

	private Computer computer;
	private LeftDetailPanel leftDetailPanel;
	private RightDetailPanel rightDetailPanel;

	public DetailPanel(Computer computer) {
		super();
		this.computer = computer;
		this.leftDetailPanel = new LeftDetailPanel(computer);
		this.rightDetailPanel = new RightDetailPanel(computer);

		init();
	}

	public void init() {

		this.setVisible(true);

		int x = 0;
		int y = 0;
		GridBagLayout gridBagLayout = GuiLayout.getGridBagLayout(this);

		double leftDetailPanelGrow = 1.0;
		double rightDetailPanelGrow = 0.0;
		double nor = 0.0;
		GridBagConstraints gridBagConstraints = GuiLayout.getGridBagConstraints();
		gridBagLayout.columnWeights = new double[] { leftDetailPanelGrow, rightDetailPanelGrow };
		gridBagLayout = GuiLayout.getGridBagLayout(this);
		GuiLayout.addToLayout(this, gridBagLayout, gridBagConstraints, x++, y, this.leftDetailPanel);
		x++;
		GuiLayout.addToLayout(this, gridBagLayout, gridBagConstraints, x++, y, this.rightDetailPanel);

	}

}
